﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Daco.Web.UI.WebControls;

namespace Daco.Web.Pages
{
    public partial class Profile : Daco.Web.UI.SitePage
    {
        DataRow _companyProfile = null;
        public Profile()
        {
            this.Load += new EventHandler(Profile_Load);
        }

        void Profile_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["cpid"]))
                _companyProfile = CWeb.GetProfile(Request.QueryString["cpid"]);
            else
                _companyProfile = CWeb.GetDefaultProfile();

            string originTitle = Page.Title;
            Page.Title = "Giới thiệu - " + originTitle;

            if (_companyProfile != null)
            {
                lProfileName.Text = _companyProfile["Name"].ToString();
                lProfileBody.Text = _companyProfile["Body"].ToString();

                // Setup page title
                Page.Title = lProfileName.Text + " - " + originTitle;
            }

            // Profile list
            Master.Body.Left.Controls.Clear();
            ULProfile profileList = new ULProfile();
            profileList.Title = "Cty TNHH DACO";
            Master.Body.Left.Controls.Add(profileList);
        }
    }
}